{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'display' && $_GPC['status']==''}class="active"{/if}><a href="{php echo $this->wurl('order')}">全部</a></li>
	<li {if $op == 'display' && empty($_GPC['status']) && $_GPC['status']!=''}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>0])}">未付款</a></li>
	<li {if $op == 'display' && $_GPC['status']==1}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>1])}">已支付</a></li>
	<li {if $op == 'display' && $_GPC['status']==4}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>4])}">申请退款</a></li>
	<li {if $op == 'display' && $_GPC['status']==5}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>5])}">待打款</a></li>
	<li {if $op == 'display' && $_GPC['status']==6}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>6])}">已退款</a></li>
	<li {if $op == 'display' && $_GPC['status']==7}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>7])}">申请返还</a></li>
	<li {if $op == 'display' && $_GPC['status']==8}class="active"{/if}><a href="{php echo $this->wurl('order',['status'=>8])}">已返还</a></li>
</ul>
{if $op == 'display'}
<style>
th{
	text-align: center !important;
}
td{
	text-align: center !important;
	white-space: normal !important;
	word-break: break-all !important;
	vertical-align: middle !important;
}
.account-stat-num > div{width:16.6%; float:left; font-size:16px; text-align:center;}
.account-stat-num > div span{display:block; font-size:30px; font-weight:bold;}
</style>
<div class="panel panel-default">
	<div class="panel-heading">
		订单数据统计
	</div>
		<div class="panel-body">
			<div class="account-stat-num row">
				<div>今日订单数量<span>{if empty($today)}0{else}{$today}{/if}</span></div>
				<div>今日订单金额<span>{if empty($today2)}0{else}{php echo number_format($today2,2)}{/if}</span></div>
				<div>昨日订单数量<span>{if empty($yes)}0{else}{$yes}{/if}</span></div>
				<div>昨日订单金额<span>{if empty($yes2)}0{else}{php echo number_format($yes2,2)}{/if}</span></div>
				<div>总订单数量<span>{if empty($all)}0{else}{$all}{/if}</span></div>
				<div>总订单金额<span>{if empty($all2)}0{else}{php echo number_format($all2,2)}{/if}</span></div>
			</div>
		</div>
</div>
<form action="" method="get" class="form-horizontal" role="form">
	<div class="panel panel-info">
        <div class="panel-heading">筛选</div>
			<div class="panel-body">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="status" value="{$_GPC['status']}" />
                <input type="hidden" name="m" value="{php echo $this->modulename}" />
                <input type="hidden" name="do" value="order" />
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">会员昵称</label>
	                <div class="col-xs-12 col-sm-2 col-lg-2">
	                    <input class="form-control" name="nickname" type="text" value="{$nickname}" placeholder="">
	                </div>
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">订单号</label>
	                <div class="col-xs-12 col-sm-2 col-lg-2">
	                    <input class="form-control" name="ordersn" type="text" value="{$ordersn}" placeholder="">
	                </div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">课程</label>
	                <div class="col-xs-12 col-sm-2 col-lg-4">
	                    <select class='form-control' name='bid'>
	                    	<option value='0'>全部课程</option>
	                    	{loop $books $b}
	                    	<option value='{$b["id"]}' {if $bid==$b['id']}selected{/if}>{$b['title']}</option>
	                    	{/loop}
	                    </select>
	                </div>
                	<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
                    <div class=" col-xs-12 col-sm-3 col-lg-3">
                        <button class="btn btn-sm btn-default" ><i class="fa fa-search"></i> 搜索</button>
                   	</div>
				</div>
			</div>
        </div>
</form>			
<div class="main">
	<div class="cate" style="background: white;">
		<table class="table table-hover">
			<thead>
				<tr>
					<th>ID</th>
					<th>订单号</th>
					<th>会员</th>
					<th>报名信息</th>
					<th>课程名</th>
					<th>支付方式</th>
					<th>金额</th>
					<th>状态</th>
					<th>下单时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $list $item}
				<tr>
					<td>{$item['id']}</td>
					<td>{$item['ordersn']}</td>
					<td><img src="{php echo toimage($mems[$item['mid']]['avatar'])}" style="width:80px;"><br>{$mems[$item['mid']]['nickname']}</td>
					<td>{$mbs[$item['id']]['uname']}<br>{$mbs[$item['id']]['mobile']}</td>
					<td>{$books[$item['bid']]['title']}</td>
					<td>
					{if $item['paytype']==1}
					<label class="label label-success">微信支付</label>
					{elseif $item['paytype']==2}
					<label class="label label-warning">余额支付</label>
					{/if}
					</td>
					<td>{$item['price']}</td>
					<td>
					{if $item['status']==1}
					<label class="label label-success">已付款</label>
					{elseif $item['status']==4}
					<label class="label label-warning">申请退款</label>
					{elseif $item['status']==5}
					<label class="label label-info">待打款</label>
					{elseif $item['status']==6}
					<label class="label label-danger">已退款</label>
					{elseif $item['status']==7}
					<label class="label label-danger">返还中</label>
					{elseif $item['status']==8}
					<label class="label label-danger">已返还</label>
					{else}
					<label class="label label-default">未付款</label>
					{/if}
					</td>
					<td>{php echo date('Y-m-d H:i',$item['createtime'])}</td>
					<td>
						{if $item['status']==4}
						<a onclick="return confirm('确定审核退款吗？');return false;" href="{php echo $this->wurl('order',array('op'=>'check','id'=>$item['id']))}" class="btn btn-sm btn-info">待审核</a>
						{/if}
						{if $item['status']==5}
						<a onclick="return confirm('确定打款吗？');return false;" href="{php echo $this->wurl('order',array('op'=>'refund','id'=>$item['id']))}" class="btn btn-sm btn-warning">待打款</a>
						{/if}
						{if $item['status']==7}
						<a onclick="return confirm('确定打款吗？');return false;" href="{php echo $this->wurl('order',array('op'=>'back','id'=>$item['id']))}" class="btn btn-sm btn-warning">申请返还</a>
						{/if}
						<a onclick="return confirm('确定删除吗？');return false;" href="{php echo $this->wurl('order',array('op'=>'del','id'=>$item['id']))}" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i> 删除</a>
					</td>
				</tr>
			{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{/if}

{template 'common/footer'}